package com.eascs.spider.ant.common.proj;

import java.io.Serializable;
import java.util.Map;

import com.alibaba.fastjson.JSON;
/**
 * 普通任务实体
 * @author hzp
 *
 */
public class Task implements Serializable{

	private static final long serialVersionUID = 2135728137053668144L;
	
	public static final String HOMEPAGE_YES = "YES";//是否主页
	
	public static final String HOMEPAGE_NO = "NO";
	
	public static final String HTTP_GET = "GET";//http get方法
	
	public static final String HTTP_POST = "POST";

	private String url;//任务待处理的链接
	
	private String method;//请求方法
	
	private String header;//请求头
	
	private String param;//请求参数
	
	private String Homepage = HOMEPAGE_NO;//是否主页请求,默认为NO
	
	private String remark;//备注
	
	private int count = 1;//任务重新加入队列次数，超过五次就放弃加入队列
	

	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	public Map<String, String> getParamMap() {
		return JSON.parseObject(this.param, Map.class);
	}

	public Task setParamMap(Map<String, String> paramMap) {
		this.param =JSON.toJSONString(paramMap); 
		return this;
	}

	public Map<String, String> getHeaderMap() {
		return JSON.parseObject(this.header, Map.class);
	}

	public Task setHeaderMap(Map<String, String> headerMap) {
		this.header = JSON.toJSONString(headerMap);
		return this;
	}

	public String getMethod() {
		return method;
	}

	public Task setMethod(String method) {
		this.method = method;
		return this;
	}

	public String getHeader() {
		return header;
	}

	public Task setHeader(String header) {
		this.header = header;
		return this;
	}

	public String getParam() {
		return param;
	}

	public Task setParam(String param) {
		this.param = param;
		return this;
	}

	public String getHomepage() {
		return Homepage;
	}

	public Task setHomepage(String homepage) {
		this.Homepage = homepage;
		return this;
	}

	public String getUrl() {
		return url;
	}

	public Task setUrl(String url) {
		this.url = url;
		return this;
	}
	
	public int getCount() {
		return count;
	}

	public Task setCount(int count) {
		this.count = count;
		return this;
	}

	@Override
	public String toString(){
		return JSON.toJSONString(this);
	}

}
